/*
 * Copyright 2011-2012 by The Regents of the University of California Licensed
 * under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. you may obtain a copy of the
 * License from
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package edu.ucsd.db.bassarisk.query.expression.visitor;

import edu.ucsd.db.bassarisk.exception.VisitorException;
import edu.ucsd.db.bassarisk.query.expression.Expressions.BooleanAnd;
import edu.ucsd.db.bassarisk.query.expression.Expressions.BooleanExpr;
import edu.ucsd.db.bassarisk.query.expression.Expressions.BooleanNot;
import edu.ucsd.db.bassarisk.query.expression.Expressions.BooleanOr;
import edu.ucsd.db.bassarisk.query.expression.Expressions.PositionMaxSeparation;
import edu.ucsd.db.bassarisk.query.expression.Expressions.PositionMinSeparation;
import edu.ucsd.db.bassarisk.query.expression.Expressions.PositionOrdered;
import edu.ucsd.db.bassarisk.query.expression.Expressions.PositionPhrase;
import edu.ucsd.db.bassarisk.query.expression.Expressions.PositionPredExpr;
import edu.ucsd.db.bassarisk.query.expression.Expressions.PositionSeparation;
import edu.ucsd.db.bassarisk.query.expression.Expressions.PositionWindow;
import edu.ucsd.db.bassarisk.query.expression.Expressions.StructureFind;
import edu.ucsd.db.bassarisk.query.expression.Expressions.StructureIn;
import edu.ucsd.db.bassarisk.query.expression.Expressions.StructurePredExpr;
import edu.ucsd.db.bassarisk.query.expression.Expressions.StructureSame;

/**
 * Abstract implementation of IQueryExpressionVisitor<R, A> which defers all
 * visitations to the super class. Use this class as a base class for visitors
 * that only need to perform actions on a small subset of the types that it
 * visits.
 * 
 * @param <R>
 * @param <A>
 */
public abstract class SupertypeDeferingExpressionTreeVisitor<R, A> implements
    ExpressionTreeVisitor<R, A> {
  @Override
  public R visitBooleanAnd(final BooleanAnd expr, final A arg)
      throws VisitorException {
    return this.visitBooleanExpr(expr, arg);
  }

  @Override
  public R visitBooleanExpr(final BooleanExpr expr, final A arg)
      throws VisitorException {
    return this.visitNonterminalExpr(expr, arg);
  }

  @Override
  public R visitBooleanNot(final BooleanNot expr, final A arg)
      throws VisitorException {
    return this.visitBooleanExpr(expr, arg);
  }

  @Override
  public R visitBooleanOr(final BooleanOr expr, final A arg) throws VisitorException {
    return this.visitBooleanExpr(expr, arg);
  }

  @Override
  public R visitPositionMaxSeparation(final PositionMaxSeparation expr, final A arg)
      throws VisitorException {
    return this.visitPositionPredExpr(expr, arg);
  }

  @Override
  public R visitPositionMinSeparation(final PositionMinSeparation expr, final A arg)
      throws VisitorException {
    return this.visitPositionPredExpr(expr, arg);
  }

  @Override
  public R visitPositionOrdered(final PositionOrdered expr, final A arg)
      throws VisitorException {
    return this.visitPositionPredExpr(expr, arg);
  }

  @Override
  public R visitPositionPhrase(final PositionPhrase expr, final A arg)
      throws VisitorException {
    return this.visitPositionPredExpr(expr, arg);
  }

  @Override
  public R visitPositionPredExpr(final PositionPredExpr expr, final A arg)
      throws VisitorException {
    return this.visitNonterminalExpr(expr, arg);
  }

  @Override
  public R visitPositionSeparation(final PositionSeparation expr, final A arg)
      throws VisitorException {
    return this.visitPositionPredExpr(expr, arg);
  }

  @Override
  public R visitPositionWindow(final PositionWindow expr, final A arg)
      throws VisitorException {
    return this.visitPositionPredExpr(expr, arg);
  }

  @Override
  public R visitStructureFind(final StructureFind expr, final A arg)
      throws VisitorException {
    return this.visitStructurePredExpr(expr, arg);
  }

  @Override
  public R visitStructureIn(final StructureIn expr, final A arg)
      throws VisitorException {
    return this.visitStructurePredExpr(expr, arg);
  }

  @Override
  public R visitStructurePredExpr(final StructurePredExpr expr, final A arg)
      throws VisitorException {
    return this.visitNonterminalExpr(expr, arg);
  }

  @Override
  public R visitStructureSame(final StructureSame expr, final A arg)
      throws VisitorException {
    return this.visitStructurePredExpr(expr, arg);
  }
}
